package boot.spring.rabbitMQ.listener;


import boot.spring.utils.ThreadPoolUtil;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import boot.spring.po.Mail;


@Component
public class QueueListener1 {

	@RabbitListener(queues = "myqueue")
	public void displayMail(Mail mail) throws Exception {
		System.out.println("队列监听器1号收到消息"+mail.toString());
		ThreadPoolUtil.getInstance().excute(new Runnable()
		{
			public void run()
			{
				//调用执行具体业务
				System.out.println("队列监听器1号收到消息开始执行业务了！！！！");
				try {
					Thread.sleep(2000);
					System.out.println("队列监听器1号  任务结束了！！！");
				} catch (InterruptedException e) {
					e.printStackTrace();
				}


			}
		});
	}
}
